<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<html>
<f:view>
	<head>
	<title>Event</title>
	</head>

	<body>
	<h1>

		<h:outputText value="#{eventController.createMode? 'Create a New Event':'Edit Event'}" />

	</h1>
	
 	<h:messages errorStyle="color: #ff0000" globalOnly="true"/>


	<h:form id="eventForm">
		<hr />
		<h:panelGrid columns="6">
			<h:outputText value="#{eventController.user.emailAddress}" />
			<h:outputText value="&nbsp;&nbsp;-&nbsp;&nbsp;" escape="false" />
			<h:commandLink action="#{homeController.home}">
				<f:param value="#{eventController.user.id}" name="userId" />
				<h:outputText value="Home" />
			</h:commandLink>
			<h:commandLink action="#{myEventsController.listMyEvents}">
				<f:param value="#{eventController.user.id}" name="userId" />
				<h:outputText value="My Events" />
			</h:commandLink>
			<h:commandLink action="#{manageAccountController.manageAccount}">
				<f:param value="#{eventController.user.id}" name="userId" />
				<h:outputText value="My Account" />
			</h:commandLink>
			<h:commandLink action="#{loginController.logout}">
				<h:outputText value="Log Out" />
			</h:commandLink>
		</h:panelGrid>
		<hr />
			<h:outputText value="<br/>" escape="false"/>
             
			 <h:outputText id="summary"/>
             	<h:message for="summary" style="color: Red" />
             	<h:outputText value="<br/>" escape="false"/>
             

		<h:panelGrid columns="2">

			<h:outputText value="Event coordinator : " />
			<h:panelGroup>
			<h:outputText value="#{eventController.user.lastName}" />
			<h:outputText value=", " />
			<h:outputText value="#{eventController.user.firstName}" />
			</h:panelGroup>
			<h:outputText value="Event name: " />
			<h:panelGroup>
				<h:inputText id="name" value="#{eventController.event.name}" />
				<h:message for="name" style="color: Red" />
			</h:panelGroup>
			<h:panelGroup>
				<h:outputText value="Event descripton: " />
				<h:outputText value="<br/>" escape="false" />
				<h:outputText value="(optional)" />
			</h:panelGroup>
			<h:inputText id="description" value="#{eventController.event.description}" />
			<h:panelGroup>
			<h:outputText value="Start date: " />
			<h:outputText value="<br/>" escape="false" />
			<h:outputText value="ex. 1/30/2007"/>
			</h:panelGroup>
			<h:panelGroup>
				 <h:inputText id="startDate" value="#{eventController.event.startDate}">
     				<f:convertDateTime type="date" pattern="MM/dd/yyyy" timeZone="CST"/>
  				</h:inputText>
				<h:message for="startDate" style="color: Red" />
			</h:panelGroup>
			<h:panelGroup>
			<h:outputText value="End date: " />
			<h:outputText value="<br/>" escape="false" />
			<h:outputText value="ex. 1/30/2007"/>
			</h:panelGroup>
			<h:panelGroup>
				 <h:inputText id="endDate" value="#{eventController.event.endDate}">
     				<f:convertDateTime type="date" pattern="MM/dd/yyyy" timeZone="CST"/>
  				</h:inputText>
				<h:message for="endDate" style="color: Red" />
			</h:panelGroup>
			<h:panelGroup>
			<h:outputText value="Start time: " />
			<h:outputText value="<br/>" escape="false" />
			<h:outputText value="ex. 12:08 pm"/>
			</h:panelGroup>
			<h:panelGroup>
				 <h:inputText id="startTime" value="#{eventController.event.startTime}">
     				<f:converter converterId="com.ochnas.volunteersignup.ui.TimeConverter"/>
  				</h:inputText>
  				<h:outputText value="#{eventController.currTimeZone}"/>
				<h:message for="startTime" style="color: Red" />
			</h:panelGroup>
			<h:panelGroup>
			<h:outputText value="End time: " />
			<h:outputText value="<br/>" escape="false" />
			<h:outputText value="ex. 12:08 pm"/>
			</h:panelGroup>
			<h:panelGroup>
				 <h:inputText id="endTime" value="#{eventController.event.endTime}">
     				<f:converter converterId="com.ochnas.volunteersignup.ui.TimeConverter"/>
  				</h:inputText>
  				<h:outputText value="#{eventController.currTimeZone}"/>
				<h:message for="endTime" style="color: Red" />
			</h:panelGroup>
		
		
		<h:outputText value="<br/><br/>" escape="false" />
		
		<h:panelGrid columns="2" cellspacing="15">
		<h:commandButton value="Save" action="#{eventController.saveEvent}" />
		<h:commandButton value="Cancel" action="#{eventController.cancelEvent}" immediate="true"/>
		</h:panelGrid>
		
		</h:panelGrid>

	</h:form>
	</body>
</f:view>
</html>